<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
  String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

	<title>修改房间</title>
	<base target="_self" />

	<link href="<%=path1%>/ht/Styles/css.css"
		rel="stylesheet" type="text/css" />
	<link href="<%=path1%>/ht/Styles/ts_css.css"
		rel="stylesheet" type="text/css" />
    <script src="<%=path1%>/ht/Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="<%=path1%>/ht/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="<%=path1%>/ht/Scripts/IndexManager.js" type="text/javascript"></script>

	<script type="text/javascript">
		
 		//查询项目
		$.ajax({
					url : "<%=path1%>/qt/ht/project/selectAlls.do",
					datatype : 'json',
					error : function(data) {
						alert("出错了！！");
					},
					success : function(data) {
						//alert("成功了");	    	   
						var len = data.msg.length;
						var select = document.getElementById("project_id");
						var project_id = $("#proid").val();
						//alert(project_id);
						var html = "";
						if (len > 0) {
							data.msg
									.forEach(function(e) {
										if (e.project_id == project_id) {
											//alert(e.project_name);
											html += "<option value="+e.project_id+" selected='selected'>"
													+ e.project_name + "</option>";
										} else {
											html += "<option value="+e.project_id+">"
													+ e.project_name + "</option>";
										}
									})
							//alert(html);
							$("#project_id").append(html);
						}
					}
				});
		//查询楼栋
    	$.ajax({
	    	url:"<%=path1%>/qt/ht/build/selectAlls.do",
	        datatype:'json', 
	        error:function(data){  
	            alert("出错了！！");  
	       },  
	       success:function(data){
	       //alert("楼栋成功了");	    	   
	       var len=data.msg.length;
	       //alert(len);
	       var select = document.getElementById("build_id");
	       //alert(select);
	       var build_id =$("#buiid").val();
	       //alert(build_id);
	       //alert(build_id);
	       var html="";
	       if(len>0){
	    	   data.msg.forEach(function(e){  
	    		    if(e.build_id == build_id){
	    		    	//alert(e.build_name);
	    		     html+="<option value="+e.build_id+" selected='selected'>"+e.build_name+"</option>";
	 	    	   }else{
	 	    		  html+="<option value="+e.build_id+">"+e.build_name+"</option>";
	 	    	   }
	    		}) 
	    		//alert(html);
	    		$("#build_id").append(html);
	         }
	       }
    	});
		
		//查询单元
    	$.ajax({
	    	url:"<%=path1%>/qt/ht/unit/selectAlls.do",
	        datatype:'json', 
	        error:function(data){  
	            alert("出错了！！");  
	       },  
	       success:function(data){
	       //alert("单元成功了");	    	   
	       var len=data.msg.length;
	       var select = document.getElementById("unit_id");
	       var unit_id=$("#uniid").val();
	       //alert(unit_id);
	       var html="";
	       if(len>0){
	    	   data.msg.forEach(function(e){  
	    		    if(e.unit_id == unit_id){
	    		    	//alert(e.project_name);
	    		     html+="<option value="+e.unit_id+" selected='selected'>"+e.unit_code+"</option>";
	 	    	   }else{
	 	    		  html+="<option value="+e.unit_id+">"+e.unit_code+"</option>";
	 	    	   }
	    		}) 
	    		//alert(html);
	    		$("#unit_id").append(html);
	         }
	       }
    	});
		
		//查询户型
    	$.ajax({
	    	url:"<%=path1%>/ht/apar/selectAlls.do",
	        datatype:'json', 
	        error:function(data){  
	            alert("出错了！！");  
	       },  
	       success:function(data){
	       //alert("户型成功了");	    	   
	       var len=data.msg.length;
	       var select = document.getElementById("apartment_layout_id");
	       var apartment_layout_id =$("#apaid").val();
	       var html="";
	       if(len>0){
	    	   data.msg.forEach(function(e){  
	    		    if(e.apartment_layout_id == apartment_layout_id){
	    		    	
	    		     html+="<option value="+e.apartment_layout_id+" selected='selected'>"+e.apartment_layout	 	    	   }else{
	 	    		  html+="<option value="+e.apartment_layout_id+">"+e.apartment_layout+"</option>";
	 	    		 
	    		     }
	    		}) 
	    		
	    		$("#apartment_layout_id").append(html);
	         }
	       }
    	});
		
		//查询用途
    	$.ajax({
	    	url:"<%=path1%>/ht/purpose/selectAlls.do",
	        datatype:'json', 
	        error:function(data){  
	            alert("出错了！！");  
	       },  
	       success:function(data){
	       //alert("用途成功了");	    	   
	       var len=data.msg.length;
	       var select = document.getElementById("purpose_id");
	       var purpose_id =$("#purid").val();
	       var html="";
	       if(len>0){
	    	   data.msg.forEach(function(e){  
	    		    if(e.purpose_id == purpose_id){
	    		     html+="<option value="+e.purpose_id+" selected='selected'>"+e.purpose	 	    	   }else{
	 	    		  html+="<option value="+e.purpose_id+">"+e.purpose+"</option>";
	 	    	   }
	    		}) 
	    		$("#purpose_id").append(html);
	         }
	       }
    	});
		
	</script>
  <script type="text/javascript">
  function breaks(){
	  window.location.href="<%=path1%>/qt/ht/project/selectAll.do";
  }
  </script>
</head>
<body>
	<form method="post" action="<%=path1%>/qt/ht/room/updateRoom.do" id="form1">
		<div id="divTwo">
			<table width="100%" border="0" cellpadding="2" cellspacing="2"
				class="table_list1">
				<h2 align="center">修改房间信息</h2>

				<tr>
					<td width="30%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 所属项目:
					</td>
					<td width="20%" class="table_list1_style2">		
					<input type="hidden" id="proid" name="proid" value="${rooms.project_id}"/>			 
					<select
						name="project_id" id="project_id" id="txtLeved"
						 class="aspNetDisabled"
						style="width: 150px; height: 24px">
						</select>					
					</td>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 所属楼栋:
					</td>
					<td width="40%" class="table_list1_style2">		
					<input type="hidden" id="buiid" name="buiid" value="${rooms.build_id}"/>			 
					<select
						name="build_id" id="build_id" id="txtLeved"
						 class="aspNetDisabled"
						style="width: 150px; height: 24px">
						</select>					
					</td>
				</tr>
				
			  <tr>
					<td width="30%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 所属单元:
					</td>
					<td width="20%" class="table_list1_style2">		
					<input type="hidden" id="uniid" name="uniid" value="${rooms.unit_id}"/>			 
					<select
						name="unit_id" id=unit_id id="txtLeved"
						 class="aspNetDisabled"
						style="width: 150px; height: 24px">
						</select>					
					</td>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 所属户型:
					</td>
					<td width="40%" class="table_list1_style2">		
					<input type="hidden" id="apaid" name="apaid" value="${rooms.apartment_layout_id}"/>			 
					<select
						name="apartment_layout_id" id="apartment_layout_id" id="txtLeved"
						 class="aspNetDisabled"
						style="width: 150px; height: 24px">
						</select>					
					</td>
				</tr>
				
			   <tr>
					
					<td width="30%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 所属用途:
					</td>
					<td width="20%" class="table_list1_style2">		
					<input type="hidden" id="purid" name="purid" value="${rooms.purpose_id}"/>			 
					<select
						name="purpose_id" id="purpose_id" id="txtLeved"
						 class="aspNetDisabled"
						style="width: 150px; height: 24px">
						</select>					
					</td>
				</tr>
				
				<!-- 取ID的值  不需要显示 -->
				<input name="room_id" id="room_id" type="hidden"
					value="${rooms.room_id}" />
					
				<tr>
					<td width="30%" class="table_list1_style1">
						<p></p>  房间房号:
					</td>
					<td width="20%" class="table_list1_style2"><input type="text"
						name="room_code" id="room_code" value="${rooms.room_code}"
						style="width: 150px; height: 24px" /></td>
					<td width="10%" class="table_list1_style1">
						<p></p>  楼层:
					</td>
					<td width="40%" class="table_list1_style2"><input type="text"
						name="floor" id="floor" value="${rooms.floor}"
						style="width: 150px; height: 24px" /></td>
				</tr>
				
				<tr>
					<td width="30%" class="table_list1_style1">
						<p></p>  建筑面积:
					</td>
					<td width="20%" class="table_list1_style2"><input type="text"
						name="units" id="units" value="${rooms.units}"
						style="width: 150px; height: 24px" /></td>
					<td width="10%" class="table_list1_style1">
						<p></p>  套内面积:
					</td>
					<td width="40%" class="table_list1_style2"><input type="text"
						name="inners" id="inners" value="${rooms.inners}"
						style="width: 150px; height: 24px" /></td>
				</tr>

	        <input type="hidden" name="update_user" id="update_user" value="${bean.name}" />
				
					<input type="hidden" name="update_time" id="update_time" value="${build.update_time}" />		

				<tr>
					<td class="table_list1_style1">&nbsp;</td>
					<td class="table_list1_style2">
						<p></p> <input type="submit" id="send" name="btnAdd" value="修改"
						 tabindex="1" class="button" /> &nbsp;&nbsp;
						<input id="btnBack" type="button" class="button" value="返回"
						onclick="breaks();"/>
						<td width="10%" class="table_list1_style1">
						<td width="40%" class="table_list1_style2">
					</td>
				</tr>
				
			</table>
		</div>
	</form>
</body>
</html>